﻿using Microsoft.Phone.Tasks;
using Q42.WinRT.Data;
using SpaceNeedle.SDK.Windows.Platform.Commands;
using SpaceNeedle.SDK.Windows.Platform.Data;
using SpaceNeedle.x6473.WindowsPhone.Common;
using SpaceNeedle.x6473.WindowsPhone.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace SpaceNeedle.x6473.WindowsPhone.ViewModels
{
    public class NewRequestViewModel : GlobalViewModel
    {
        public NewRequestViewModel() :base()
        {

        }

        public AppContent.NewRequestInfo StaticContent
        {
            get { return this.Get<AppContent.NewRequestInfo>(); }
            set { this.Set(value); }
        }

        public ObservableCollection<Request> Requests
        {
            get { return this.Get<ObservableCollection<Request>>(); }
            set { this.Set(value); }
        }

        public string PageTitle
        {
            get { return this.Get<string>(); }
            set { this.Set(value); }
        }
        
        protected async override void Load()
        {
            this.IsInProgress = true;

            await base.LoadAsync();

            this.StaticContent = this.AppContent.NewRequest;

            this.Requests = await AppViewModel.Instance.LoadRequests();

            Tracking.SendView(ViewsNames.NewRequest);

            this.IsInProgress = false;
        }
    }
}
